<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>移出数组中与‘2’相关的元素</title>
    <script>
        var arr = [1,2,3,4,2,5,6,2,7,2];
        var no2 = [];
        for( var i = 0; i<arr.length;i++){
            if(arr[i] != 2){
                no2[no2.length] = arr[i];
            }
        }
        console.log(no2);
    </script>
</head>
<body>

</body>
</html>